<?php

require_once("config.php");

$page_title = "";

function pagina_inicio($vTitulo)
{
	global $page_title;
	/* validacao da W3Consortium */
	?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
	<html><head>
	<link rel='shortcut icon' href='favicon.ico' >
	<meta http-equiv='Content-type' content='text/html; charset=utf-8' >
	<link rel='stylesheet' type='text/css' href='style/reset.css' >

	<?php
	$page_title = $vTitulo;

	if (isset($_GET['print']))
	{
		echo "<link rel='stylesheet' type='text/css' href='style/print.css' onLoad='window.print()'>";
	}
	else
	{
		echo "<link rel='stylesheet' type='text/css' href='style/base.css'>";
	}
}

function adicionar_css($vCss)
{
	if (!isset($_GET['print']))
		echo "<link rel='stylesheet' type='text/css' href='style/$vCss'>";
}

function adicionar_js($vJs)
{
	echo "<script type='text/javascript' src='script/$vJs'></script>";
}

function pagina_head()
{
	global $page_title;

	?>
	<title><?php echo $page_title ?></title>
	</head><body>
	<script type='text/javascript' language="JavaScript">
	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("menu");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload=startList;
	</script>
	<div id='pagina'>
	<div id='topo'>
	<?php

	if (isset($_GET['print']))
		echo "<img class='logo' src='img/icone-print.png' />";
	else
		echo "<a href='img/icone-large.png'><img class='logo' src='img/icone.png' alt='Safety Park inc.'></a>";

	echo "<h1>ParkSys</h1>";
	echo "<h2>" . top_msg . "</h2>";

	if (isset($_SESSION[site_id]['permission']) && $_SESSION[site_id]['permission'] >= 1)
	{
		echo "<ul id='menu'>";
		echo "<li><a href='employee.php' title='Your information' >Home</a></li>";

		if ($_SESSION[site_id]['permission'] >= 2)
		{
			echo "<li><a href='reports.php' title='Reports analysis and entry' >Reports</a><ul>";
				echo "<li><a href=report_new.php title='Add new report' ><img src='img/addlink.gif' alt='+' > report</a></li>";
			echo "</ul></li>";

			if ($_SESSION[site_id]['permission'] >= 3)
			{
				echo "<li><a href=locations.php title='Locations management and information' >Locations</a><ul>";
					echo "<li><a href=location_new.php title='Add new location' ><img src='img/addlink.gif' alt='+' > location</a></li>";
				echo "</ul></li>";
				echo "<li><a href=employees.php title='Employees management and information'>Employees</a><ul>";
					echo "<li><a href=employee_new.php title='Add new employees' ><img src='img/addlink.gif' alt='+' > employee</a></li>";
				echo "</ul></li>";
				echo "<li><a href=customers.php title='Customer management and information' >Customers</a><ul>";
					echo "<li><a href=customer_new.php title='Add new customer' ><img src='img/addlink.gif' alt='+' > customer</a></li>";
				echo "</ul></li>";
				echo "<li><a href=supplies.php title='Supplies management and information' >Supplies</a><ul>";
					echo "<li><a href=supply_new.php title='Add new supply' ><img src='img/addlink.gif' alt='+' > supply</a></li>";
				echo "</ul></li>";
				echo "<li><a href=incomes_expenses.php title='Incomes and Expenses management and information'>Incomes &amp Expenses</a><ul>";
					echo "<li><a href=income_new.php title='Add new income' ><img src='img/addlink.gif' alt='+' > income</a></li>";
					echo "<li><a href=expense_new.php title='Add new expense' ><img src='img/addlink.gif' alt='+' > expense</a></li>";
				echo "</ul></li>";
        		echo "<li><a href='statistics.php' title='Location Anual statistics' >Statistics</a></li>";
			}

		}
		echo "<li><a href='msgbook.php' title='Message book' >Messages</a></li>";
		echo "<li><small><a href='index.php?logout=1' title='End session and return to logon page' >Log out</a></small></li>";
		echo "</ul>";

	}

	echo "</div>";
	echo "<div id='conteudo'>";

/*
	echo "<p><img src='img/exclamation.png' alt='!' /><strong>Please contact Safety Park for billing. The system will be working after payment.</strong></p>";
	pagina_fim();
	die();
*/

	/* verifica se existe mensagem */
	if (isset($_GET['msg']) || isset($msg))
	{
		echo "<div class=msg>";
		echo "<p>", (isset($_GET['msg'])? $_GET['msg'] : $msg), "</p>";
		echo "</div>";
	}
}

function pagina_fim()
{
	echo "</div><div id='rodape'>";
	echo bottom_msg;
	echo "</div></div></body></html>";

//	@mysql_close();
}

?>
